import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/values/MyColors.dart';
import 'package:flutter_app/widget/custom_app_bar.dart';
import 'package:flutter_app/widget/empty_view.dart';
import 'package:flutter_app/widget/preview_grid_view.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';

import 'film_detail_logic.dart';

/**
 * @Description: 随手拍上报记录详情
 * @Author: 下雨了
 * @CreateDate: 2022年5月31日 13:59:55
 * @Version: 1.0
 */
///
class FilmDetailPage extends StatelessWidget {
  final String title;
  const FilmDetailPage({Key? key, required this.title}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final logic = Get.put(FilmDetailLogic());
    final state = Get.find<FilmDetailLogic>().state;

    return GetBuilder<FilmDetailLogic>(builder: (logic) {
      return Scaffold(
        backgroundColor: MyColors.FFF1F1F1,
        appBar: MyAppBar(context, title: "上报详情"),
        body: SingleChildScrollView(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                margin: EdgeInsets.only(left: 16.r, right: 16.r, top: 11.r),
                child: BrnShadowCard(
                  padding: EdgeInsets.only(
                      top: 16.r, bottom: 24.r, left: 32.r, right: 32.r),
                  circular: 4,
                  spreadRadius: 1,
                  child: Column(
                    children: [
                      SizedBox(
                        width: 70.r,
                        height: 70.r,
                        child: Image.asset(logic.getTagObj()["url"]),
                      ),
                      SizedBox(
                        height: 5.5.r,
                      ),
                      Center(
                        child: Text(
                          logic.getTagObj()["title"],
                          style: TextStyle(
                              color: logic.getTagObj()["textColor"],
                              fontSize: 18.sp),
                        ),
                      ),
                      SizedBox(
                        height: 4.5.r,
                      ),
                      Center(
                        child: Text(
                          logic.getTagObj()["content"],
                          maxLines: 2,
                          textAlign: TextAlign.center,
                          style: TextStyle(
                            color: MyColors.FF666666,
                            fontSize: 12.sp,
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
              Container(
                width: Get.width,
                margin: EdgeInsets.only(left: 16.r, right: 16.r, top: 10.r),
                child: BrnShadowCard(
                  padding: EdgeInsets.only(
                      top: 17.5.r, bottom: 20.r, left: 16.r, right: 16.r),
                  circular: 4,
                  spreadRadius: 1,
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        "图片/视频证据",
                        style: TextStyle(
                            color: MyColors.FF333333,
                            fontSize: 14.sp,
                            fontWeight: FontWeight.w600),
                      ),
                      SizedBox(
                        height: 8.r,
                      ),
                      logic.thumbnailPaths.length > 0
                          ? PreviewGridView(
                              spacing: 10.r,
                              thumbnailPath: logic.thumbnailPaths,
                              sourcePath: logic.sourcePaths,
                            )
                          : EmptyView(),
                      SizedBox(
                        height: 16.r,
                      ),
                      Text(
                        "标题",
                        style: TextStyle(
                            color: MyColors.FF333333,
                            fontSize: 14.sp,
                            fontWeight: FontWeight.w600),
                      ),
                      SizedBox(
                        height: 4.r,
                      ),
                      Text(
                        state.listOtherProblemContent?.title ?? "",
                        style: TextStyle(
                            color: MyColors.FF333333, fontSize: 14.sp),
                      ),
                      SizedBox(
                        height: 11.5.r,
                      ),
                      Text(
                        "详细说明",
                        style: TextStyle(
                            color: MyColors.FF333333,
                            fontSize: 14.sp,
                            fontWeight: FontWeight.w600),
                      ),
                      SizedBox(
                        height: 8.5.r,
                      ),
                      Container(
                        width: Get.width,
                        padding: EdgeInsets.only(
                            left: 10.r,
                            top: 6.5.r,
                            right: 10.r,
                            bottom: 17.5.r),
                        decoration: BoxDecoration(color: MyColors.FFF1F4F8),
                        child: Text(
                          state.listOtherProblemContent?.content ?? "",
                          style: TextStyle(
                              color: MyColors.FF333333, fontSize: 12.sp),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ],
          ),
        ),
      );
    });
  }
}
